// 类别结构体
interface TypeCategory {
  id: number,
  name: string
}

interface TypeGoods {
  cateGoryId: number,
  id: number,
  name: string,
  imageUrl: string,
  price: number
}

// 类别
class ClsCategory {
  private arrCateData: Array<TypeCategory> = [{
    id: 1,
    name: "手机"
  }, {
    id: 2,
    name: "平板"
  }, {
    id: 3,
    name: "电视"
  }]

  getCategoryData() {
    return this.arrCateData
  }
}
// 类别
class ClsGoods {
  private arrGoodsData: Array<TypeGoods> = [{
    id: 1,
    cateGoryId: 1,
    name: "华为手机",
    imageUrl: '',
    price: 100
  }, {
    id: 2,
    cateGoryId: 2,
    name: "小米平板",
    imageUrl: '',
    price: 100
  }, {
    id: 3,
    cateGoryId: 3,
    name: "创维电视",
    imageUrl: '',
    price: 100
  }]

  getGoodsData(gid: number) {
    let arrCurGoods = this.arrGoodsData.filter(item => item.cateGoryId == gid)
    return arrCurGoods
  }
}

// 实例化对象
let objCategory = new ClsCategory();
let objGoods = new ClsGoods();

export {
  TypeCategory,TypeGoods,
  objCategory, objGoods
}